<?php if (!defined('SERVER_ROOT')){exit('No direct script access allowed');}
$this->template->title = 'Hệ thống hỗ trợ công tác quản lý cán bộ trường ĐHTG';
$v_pop_win = isset($_REQUEST['pop_win']) ? '_pop_win' : '';
$this->template->display('dsp_header' . $v_pop_win . '.php');
 $v_row = 0;
?>
<script>
    $(function() {
        $("#tabs_user").tabs();
    });
</script>
<form name="frmMain" method="post" id="frmMain" action=""><?php
    echo $this->hidden('controller', $this->get_controller_url());
    echo $this->hidden('hdn_dsp_single_method', 'dsp_single_canbo');
    echo $this->hidden('hdn_dsp_all_method', 'dsp_all_canbo');
    echo $this->hidden('hdn_update_method', 'update_canbo');
    echo $this->hidden('hdn_delete_method', 'delete_canbo');
    echo $this->hidden('hdn_item_id', $var_macanbo);
    echo $this->hidden('pop_win', $v_pop_win);
    $MA_PHU_CAP_CHUC_VU=0;
    ?>
    <h5 style="text-align: center">Phụ cấp chức vụ <?php echo $var_tencanbo; ?></h5>
    <div id="tabs_user">
        <ul>
            <li><a href="#tab1">Cập nhật PC chức vụ</a></li>
            <li><a href="#tab2">Quá trình PC chức vụ</a></li>
        </ul>
        <div id="tab1">
            <div class="Row">
                <div class="left-Col">Phụ cấp chức vụ</div>
                <div class="right-Col">
                    <select id="cbx_MA_PCCV_MOI"  name="cbx_MA_PCCV_MOI" style="width:96%"
                      onchange="get_HSPCCV_by_mapccv(this.value)">

                        <?php while ($arr = $arr_all_phucapchucvu->FetchRow()): ?>
                            <?php
                            $MA_PHU_CAP_CHUC_VU_CBX = $arr['MA_PHU_CAP_CHUC_VU'];
                            $TEN_PHU_CAP_CHUC_VU_CBX = $arr['TEN_PHU_CAP_CHUC_VU'];
                            ?>
                            <?php if ($MA_PHU_CAP_CHUC_VU == $MA_PHU_CAP_CHUC_VU_CBX): ?>
                                <option value="<?php echo $MA_PHU_CAP_CHUC_VU_CBX; ?>" selected="selected"><?php echo $TEN_PHU_CAP_CHUC_VU_CBX; ?></option>
                                    <?php else: ?>
                                                <option value="<?php echo $MA_PHU_CAP_CHUC_VU_CBX; ?>" ><?php echo $TEN_PHU_CAP_CHUC_VU_CBX; ?></option>
                                    <?php endif ?>
                         <?php endwhile; ?>
                    </select>
                </div>
            </div>

            <div class="Row">
                <div class="left-Col">Hệ số <label class="required">(*)</label> </div>
                <div class="right-Col">
                    <input type="text" name="txt_HSPCCV_MOI"
                           id="txt_HSPCCV_MOI"
                           value="<?php //echo $HE_SO_LUONG; ?>"
                           class="inputbox" maxlength="255" style="width:95%"
                           onKeyDown="return handleEnter(this, event);"
                           data-allownull="no" data-validate="text"
                           data-name="hệ số lương"
                           data-xml="no" data-doc="no"
                           readonly="readonly"
                           />
                </div>
            </div>

            <div class="Row">
                <div class="left-Col">Tháng bắt đầu <label class="required">(*)</label> </div>
                <div class="right-Col">
                    <input type="text" name="txt_THANG_BAT_DAU_MOI"
                           id="txt_THANG_BAT_DAU_MOI"
                           value="<?php //echo $THANG_BAT_DAU; ?>"
                           class="inputbox" maxlength="255" style="width:95%"
                           onKeyDown="return handleEnter(this, event);"
                           data-allownull="no" data-validate="text"
                           data-name="tháng bắt đầu"
                           data-xml="no" data-doc="no"
                           />
                </div>
            </div>



            <div class="Row">
                <div class="left-Col">Năm bắt đầu <label class="required">(*)</label>  </div>
                <div class="right-Col">
                    <input type="text" name="txt_NAM_BAT_DAU_MOI"
                           id="txt_NAM_BAT_DAU_MOI" value="<?php //echo $NAM_BAT_DAU; ?>"
                           class="inputbox" maxlength="255" style="width:95%"
                           onKeyDown="return handleEnter(this, event);"
                           data-allownull="no" data-validate="number"
                           data-name="năm bắt đầu"
                           data-xml="no" data-doc="no"
                     />
                </div>
            </div>
            <div class="button-area">
                <input type="button" name="update" class = 'button' value="Cập nhật" onclick="btn_capnhat_HSPCCVmoi_onclick();"/>
            <?php $v_back_action = ($v_pop_win === '') ? 'btn_back_onclick();' : 'try{window.parent.hidePopWin();}catch(e){window.close();};'; ?>
                <input type="button" name="cancel" class = 'button' value="Bỏ qua" onclick="<?php echo $v_back_action; ?>"/>
            </div>
        </div>
















        <div id="tab2">
            <div class="Row">
                <div id="group_of_user" class="edit-box">
                    <table width="100%" class="adminlist" cellspacing="0" border="1" id="tbl_user_in_group">
                        <colgroup>
                            <col width="35%" />
                            <col width="15%" />
                            <col width="25%" />
                            <col width="25%" />
                        </colgroup>
                        <tr>
                            <th>Bậc ngạch</th>
                            <th>Hệ số</th>
                            <th>Năm bắt đầu</th>
                            <th>Tháng bắt đầu</th>
                        </tr>
                        <?php while ($arr = $arr_quatrinhpccv->FetchRow()): ?>
                          <?php
                                  $TEN_PHU_CAP_CHUC_VU = $arr['TEN_PHU_CAP_CHUC_VU'];
                                  $HE_SO_PHU_CAP_CHUC_VU= $arr['HE_SO_PHU_CAP_CHUC_VU'];
                                  $THANG_BAT_DAU_AP_DUNG = $arr['THANG_BAT_DAU_AP_DUNG'];
                                  $NAM_BAT_DAU_AP_DUNG = $arr['NAM_BAT_DAU_AP_DUNG'];
                                  $v_row++;
                          ?>
                          <tr class="<?php echo $v_class;?>">
                              <td><?php echo $TEN_PHU_CAP_CHUC_VU;?></td>
                              <td style="text-align:center"><?php echo $HE_SO_PHU_CAP_CHUC_VU;?></td>
                              <td style="text-align:center"><?php echo $NAM_BAT_DAU_AP_DUNG;?></td>
                              <td style="text-align:center"><?php echo $THANG_BAT_DAU_AP_DUNG;?></td>
                          </tr>
                        <?php endwhile; ?>
                    </table>
                </div>
            </div>
        </div>
    </div>


</div>


</form>
<script type="text/javascript">
    function get_HSPCCV_by_mapccv(m){
              $.ajax({url: "<?php echo SITE_ROOT; ?>quanlyluong/luongcanbo/dsp_txt_HSPCCV/" + m, success: function(result) {
                $("#txt_HSPCCV_MOI").val(result);
            }
        });
    }
    function btn_capnhat_HSPCCVmoi_onclick() {
        var f = document.frmMain;
        m = $("#controller").val() + 'capnhat_HSPCCVmoi/0/';
        var xObj = new DynamicFormHelper('', '', f);
        if (xObj.ValidateForm(f)) {
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }
</script>
<?php
$this->template->display('dsp_footer' . $v_pop_win . '.php');